<?php

declare(strict_types=1);

namespace App\Request\Publics;

use App\Request\FormRequest;

/**
 * Class Login
 * @author zx
 * @package App\Request\Publics
 */
class Login extends FormRequest
{
    protected array $scenes = [
        'oauth2' => [
            'code',
            'no'
        ],
        'save' => [
            'username',
            'password'
        ]
    ];

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'code' => 'required|max:50',
            'no' => 'max:50',
            'username' => [
                'required',
                'between:5,18',
                'alpha_dash'
            ],
            'password' => 'required|between:6,32'
        ];
    }
}
